<?php
$params = require(__DIR__ . '/../api/config/params.php'); 

if (YII_ENV == 'dev') {
    $params['web_url'] = 'http://localhost/chindor_kpi/basic/web';
    $params['api_url'] = 'http://localhost/chindor_kpi/basic/api';
    $params['img_host'] = 'http://localhost/chindor_kpi/basic';
    $params['wap_url'] = 'http://localhost/chindor_kpi/wap';
} else {

    $params['web_url'] = 'http://kpi.chindor.com/wab';
    $params['api_url'] = 'http://kpi.chindor.com/api';
    $params['img_host'] = 'http://localhost/kpi/basic';

}
//图片地址
// $params['img_host']  = 'http://kpi.zhnews.com';
//$params['img_host']  = 'http://zhnews.chindor.com';
//视频地址
$params['video_host'] = 'http://www.hitodo.net';
$params['appkey']    = 'ccf8556a41023dbdc2724e9914ae4fbe';
$params['appsecret'] = '39f9ff1cb52d';
$params['register_code'] = 'chindor';
$params['wap_url'] = 'http://localhost/chindor_kpi/basic/wap';

//分享地址
$params['share_url'] = 'http://www.hitodo.net/wap/home/content';


$config = [
    'id' => 'basic',
    'timeZone' => 'Asia/Shanghai',
    'language'=>'zh-CN',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'defaultRoute' => 'v1/news/default/index',

    'components' => [
        'request' => [
            'cookieValidationKey' => '9oVZ7xEIgyyBlpE5_Fp0WxDTCjahLrP1',
            'enableCsrfValidation' => false,
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'suffix' => false,//后缀
            'enableStrictParsing'=>false,//不要求网址严格匹配，则不需要输入rules
            'rules' => require(__DIR__ . '/../api/config/rule.php'),
        ],
        'errorHandler' => [
            'errorAction' => 'v1/home/error/index',
            //'errorAction' => 'site/error',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'db' => require(__DIR__ . '/db.php'),
    ],

    'params' => $params,
    'modules' => [
        'v1' => [
            'class' => 'app\api\modules\v1\Module',
        ],
        'v2' => [
            'class' => 'app\api\modules\v2\Module',
        ],

    ],
];

return $config;
